package com.sky.config;

import com.sky.properties.TentCosProperties;
import com.sky.utils.TentCosUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class TencentCosConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public TentCosUtil tentCosUtil(TentCosProperties tentCosProperties) {
        log.info("创建TentOSS工具对象{}",tentCosProperties);
        return new TentCosUtil(tentCosProperties.getRegion(),
                tentCosProperties.getSecretId(),
                tentCosProperties.getSecretKey(),
                tentCosProperties.getBucketName(),
                tentCosProperties.getRegoinAddr());
    }
}
